#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

void threeangle(int num) {
	int count = 1;
	int** arr = (int**)malloc(sizeof(int*) * num);
	for (int k = 0; k < num; k++)
	{
		arr[k] = (int*)malloc(sizeof(int) * num);
	}
	for (int i = 0; i < num; i++)
	{
		arr[count - 1][0] = 1;
		arr[count - 1][count - 1] = 1;
		for (int j = 0; j < count; j++)
		{
			if (j > 0 && j < count - 1 && count > 2)
			{
				arr[count - 1][j] = arr[count - 2][j - 1] + arr[count - 2][j];
			}
			printf("%d ", arr[count-1][j]);
		}
		printf("\n");
		count++;
	}
	for (int i = 0; i < num; i++)
	{
		free(arr[i]);
	}
	free(arr);
}

//int main()
//{
//	int num;
//	scanf("%d", &num);
//	threeangle(num);
//	return 0;
//}